#include <boost/intrusive/set.hpp>
#include <string>
#include <iostream>

struct person //* use member_hook instead of base_hook
{
	std::string m_name;
	int m_age;
	boost::intrusive::set_member_hook<> m_set_hook; //* member_hook

	person(std::string name, int age) : m_name(name), m_age(age) {}
	bool operator<(const person &p) const //* for set order
	{
		return m_age < p.m_age;
	}
};

int main()
{
	person p1("Euler",23);
    person p2("Gauss",21);
    person p3("Poincare",22);

	typedef boost::intrusive::member_hook
		<person, boost::intrusive::set_member_hook<>, &person::m_set_hook> 
		person_member_hook;
	typedef boost::intrusive::set<person,person_member_hook> person_set;
	person_set pset;

	pset.insert(p1); //*push_back compiled, but not in the right order when printing out
	pset.insert(p2);
	pset.insert(p3);

	for (person_set::iterator it = pset.begin(); it!=pset.end(); ++it)
		std::cout << it->m_name << " : " << it->m_age << std::endl;
}